#pragma once

#include "material.hpp"
#include "shape.hpp"

struct ShapeInstance {
    const Shape &shape;
    Material material;
    //转换矩阵
    glm::mat4 world_from_object;
    glm::mat4 object_from_world;
};

struct Scene: public Shape{
public :

    void addShape(
        const Shape &shape ,

        const Material &material = {},
        //位置
        const glm::vec3 &pos ={0,0,0}, 
        //缩放
        const glm::vec3 &scale = {1,1,1},
        //旋转
        const glm::vec3 &rotate = {0,0,0}
    );
    
    std::optional<HitInfo> intersect(
        const Ray &ray, 
        float t_min = 1e-5, 
        float T_max= std::numeric_limits<float>::infinity()
    ) const override;
private:
    std::vector<ShapeInstance> instances;
};

